/*
Copyright 2007 Luke Benstead

This file is part of slMath.

slMath is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

slMath is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser Public License for more details.

You should have received a copy of the GNU Lesser Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef PLANE_H_INCLUDED
#define PLANE_H_INCLUDED

#include "utility.h"
#include "vec3.h"

typedef struct slPlane {
	slVec3 		m_N;
	slScalar 	m_D;
};

slScalar slPlaneDot(const slPlane* pP, const slVec4* pV);
slScalar slPlaneDotCoord(const slPlane* pP, const slVec3* pV);
slScalar slPlaneDotNormal(const slPlane* pP, const slVec3* pV);
slPlane* slPlaneFromPointNormal(slPlane* pOut, const slVec3* pPoint, const slVec3* pNormal);
slPlane* slPlaneFromPoints(slPlane* pOut, const slVec3* p1, const slVec3* p2, const slVec3* p3);
slVec3*  slPlaneIntersectLine(slVec3* pOut, const slPlane* pP, const slVec3* pV1, const slVec3* pV2);
slPlane* slPlaneNormalize(slPlane* pOut, const slPlane* pP);
slPlane* slPlaneScale(slPlane* pOut, const slPlane* pP, slScalar s);

#endif // PLANE_H_INCLUDED
